<?php

/**
 * 省市区
 */

namespace app\crontab\model;

use app\common\lib\RespCode;
use app\common\model\BaseModel;
use custom\Err;
use think\Db;
use think\Exception;

class Region extends BaseModel {

    public function edit($initials, $id) {
        $sql = "update erp_region set initials='" . $initials . "' where id={$id}";
        $this->execute($sql);
    }

    /**
     * 区域房源套数统计
     * @param $adcode
     * @return bool
     * @throws Exception
     */
    public function incOne($adcode) {
        if (!db('region')->where(['city_code' => $adcode])->setInc('house_number')) {
            throw new Exception('区域数据统计失败', RespCode::PARAMS_ERR);
        }
        return true;
    }

}
